package zjut.cocouml.wizard;

import org.eclipse.jface.wizard.Wizard;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.widgets.*;

import zjut.cocouml.wizard.page.ModifyAttributeWizardPage;

public class ModifyAttributeWizard extends Wizard{
	
	private String oldName;
	private String newName;
	
	private String type;
	private String accessAuthrity;
	
	private boolean isFinal;
	private boolean isStatic;
	
	
	public String getType() {
		return type;
	}

	public String getAccessAuthrity() {
		return accessAuthrity;
	}

	public boolean isFinal() {
		return isFinal;
	}

	public boolean isStatic() {
		return isStatic;
	}

	public ModifyAttributeWizard(String oldName,boolean isInterface) {
		this.oldName = oldName;
		
		addPage(new ModifyAttributeWizardPage("ModifyAttribute",isInterface));
		
	}
	
	public boolean performFinish() {
		System.out.println("pageName == "+ getPage("ModifyAttribute"));
		ModifyAttributeWizardPage page = (ModifyAttributeWizardPage)getPage("ModifyAttribute");
		
		this.newName = page.getTextName();
		this.accessAuthrity = page.getAccessAuthrity();
		this.isFinal = page.getModifiers().contains("final");
		this.isStatic = page.getModifiers().contains("static");
		this.type = page.getTypeName();
		
		System.out.println("................. ModifyAttributeWizard newName == " + newName);
		System.out.println("................. ModifyAttributeWizard newName == " + isStatic);

		return true;
	}

	public String getNewName() {
		return newName;
	}
}
